<template>
	<view style="display: flex;flex-direction: row;flex-wrap: wrap;align-content: flex-start;"
	:style="{
	    'background': nodeModel.background,
		'marginTop': nodeModel.marginTop+'rpx',
		'marginBottom': nodeModel.marginBottom+'rpx',
		'marginLeft': nodeModel.marginLeft+'rpx',
		'marginRight': nodeModel.marginLeft+'rpx',
		'paddingTop': nodeModel.paddingTop+'rpx',
		'paddingBottom': nodeModel.paddingBottom+'rpx',
		'paddingLeft': nodeModel.paddingLeft+'rpx'
		}">
		<view v-for="(item, index) in nodeModel.advertList" :key="index" @click="itemHandle(item)"
		style="display: flex;"
		:style="{
			'width': nodeModel.widthForFlex1+'rpx',
			'flex-direction': nodeModel.flex_directionForFlex1,
			'align-items': nodeModel.align_itemsForFlex1,
			'background': nodeModel.backgroundForFlex1,
			'marginTop': nodeModel.marginTopForFlex1+'rpx',
			'marginLeft': nodeModel.marginLeftForFlex1+'rpx',
			'paddingTop': nodeModel.paddingTopForFlex1+'rpx',
			'paddingBottom': nodeModel.paddingBottomForFlex1+'rpx',
			'paddingLeft': nodeModel.paddingLeftForFlex1+'rpx',
		}">
			<view v-if="item.fileType=='image'">
				<u-image :width="nodeModel.widthForCover1+'rpx'" :height="nodeModel.heightForCover1+'rpx'" :radius="nodeModel.borderRadiusForCover1+'rpx'" :src="item.coverUrl" mode='aspectFill'></u-image>
			</view>
			<view v-if="item.fileType=='video'">
				<video id="myVideo" :src="item.coverUrl" object-fit='cover' enable-danmu danmu-btn controls
				:style="{
					'width': nodeModel.widthForCover1+'rpx',
					'height': nodeModel.heightForCover1+'rpx'
				}"></video>
			</view>
			<view v-if="nodeModel.isShowForText1 && item.title" style="border: #007AFF00 1rpx solid;" :style="{
				'paddingTop': nodeModel.paddingTopForFlex2+'rpx',
				'paddingBottom': nodeModel.paddingBottomForFlex2+'rpx',
				'paddingLeft': nodeModel.paddingLeftForFlex2+'rpx',
				'paddingRight': nodeModel.paddingRightForFlex2+'rpx',
			}">
				<view v-if="nodeModel.isShowForText1 && item.title" :style="{
					'marginTop': nodeModel.marginTopForText1+'rpx',
					'color': nodeModel.colorForText1,
					'font-size': nodeModel.fontsizeForText1 + 'rpx',
					'font-weight': nodeModel.fontweightForText1,
				}">{{item.title}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {count} from '@/common/utils/count.js'
	export default{
		name: 'jc-grid',
		props: {
			nodeModel: {
				type: Object,
				default: {}
			}
		},
		data() {
			return {
			}
		},
		methods:{
			itemHandle(e){
				if(e.fileType=='image'){
					this.$emit('itemHandle', e)
				}
			}
		}
	}
</script>

<style>
</style>
